//
//	ZcoModelMember.m
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "ZcoModelMember.h"

NSString *const kZcoModelMemberClientInfo = @"clientInfo";
NSString *const kZcoModelMemberIdField = @"id";
NSString *const kZcoModelMemberRole = @"role";
NSString *const kZcoModelMemberUser = @"user";
NSString *const kZcoModelMemberAt = @"at";
NSString *const kZcoModelMemberStatus = @"status";

@interface ZcoModelMember ()
@end
@implementation ZcoModelMember




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kZcoModelMemberClientInfo] isKindOfClass:[NSNull class]]){
		self.clientInfo = [[ZcoModelClientInfo alloc] initWithDictionary: dictionary[kZcoModelMemberClientInfo]];
	}	
	if(![dictionary[kZcoModelMemberIdField] isKindOfClass:[NSNull class]]){
		self.idField = dictionary[kZcoModelMemberIdField];
	}	
	if(![dictionary[kZcoModelMemberRole] isKindOfClass:[NSNull class]]){
		self.role = dictionary[kZcoModelMemberRole];
	}
    if(![dictionary[kZcoModelMemberAt] isKindOfClass:[NSNull class]]){
        self.at = dictionary[kZcoModelMemberAt];
    }
    if(![dictionary[kZcoModelMemberStatus] isKindOfClass:[NSNull class]]){
        self.status = dictionary[kZcoModelMemberStatus];
    }
	if(![dictionary[kZcoModelMemberUser] isKindOfClass:[NSNull class]]){
		self.user = [[ZcoModelUser alloc] initWithDictionary:dictionary[kZcoModelMemberUser]];
	}

	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	if(self.clientInfo != nil){
        dictionary[kZcoModelMemberClientInfo] = [self.clientInfo toDictionary];
	}
	if(self.idField != nil){
		dictionary[kZcoModelMemberIdField] = self.idField;
	}
	if(self.role != nil){
		dictionary[kZcoModelMemberRole] = self.role;
	}
    if(self.at != nil){
        dictionary[kZcoModelMemberAt] = self.at;
    }
    if(self.status != nil){
        dictionary[kZcoModelMemberStatus] = self.status;
    }
	if(self.user != nil){
		dictionary[kZcoModelMemberUser] = [self.user toDictionary];
	}
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.clientInfo != nil){
		[aCoder encodeObject:self.clientInfo forKey:kZcoModelMemberClientInfo];
	}
	if(self.idField != nil){
		[aCoder encodeObject:self.idField forKey:kZcoModelMemberIdField];
	}
	if(self.role != nil){
		[aCoder encodeObject:self.role forKey:kZcoModelMemberRole];
	}
    if(self.at != nil){
        [aCoder encodeObject:self.at forKey:kZcoModelMemberAt];
    }
    if(self.status != nil){
        [aCoder encodeObject:self.status forKey:kZcoModelMemberStatus];
    }
	if(self.user != nil){
		[aCoder encodeObject:self.user forKey:kZcoModelMemberUser];
	}

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.clientInfo = [aDecoder decodeObjectForKey:kZcoModelMemberClientInfo];
	self.idField = [aDecoder decodeObjectForKey:kZcoModelMemberIdField];
	self.role = [aDecoder decodeObjectForKey:kZcoModelMemberRole];
    self.at = [aDecoder decodeObjectForKey:kZcoModelMemberAt];
    self.status = [aDecoder decodeObjectForKey:kZcoModelMemberStatus];
	self.user = [aDecoder decodeObjectForKey:kZcoModelMemberUser];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	ZcoModelMember *copy = [ZcoModelMember new];

	copy.clientInfo = [self.clientInfo copy];
	copy.idField = [self.idField copy];
	copy.role = [self.role copy];
    copy.at = [self.at copy];
    copy.status = [self.status copy];
	copy.user = [self.user copy];

	return copy;
}

- (NSString *)getVideoLabel{
    return [NSString stringWithFormat:@"%@%@" , self.role , self.user.name];
}

-(NSString *)getScreenVideoLabel{
    return [NSString stringWithFormat:@"screen%@" , self.user.name];
}
@end
